<!DOCTYPE html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <script src="./js/vue.js"></script>
</head>

<body>
    <div id="app">
        <xyz :msg="msg" @my-event="child"></xyz>
    </div>
    <script>
        var component1 = {
            props:['msg'],
            data(){
                return{
                    xyzMsg:'我是子组件的数据'

                }
            },
            template:` 
            <div>
                <h3>大数据2031-----{{msg}}</h3> 
            <button @click="click1">发送数据</button>  
            </div>
                         
            `,
            methods:{
                click1(){
                    this.$emit('my-event',this.xyzMsg)
                }

            }

        }
        var vm = new Vue({
            el: '#app',
            data: {
                msg:'我不是大数据2031'
            },
            methods: {
                child(val){
                    console.log(val);
                    

                }
            },
            components:{
                'xyz':component1
            }
        })
    </script>
</body>

</html>